﻿<%@ page language="java" import="java.util.*,cn.ac.cintcm.dataconverge.util.Constants,com.hs.core.utils.*" pageEncoding="UTF-8"%>
<%@ page import ="cn.ac.cintcm.dataconverge.researchsubject.domain.*,cn.ac.cintcm.dataconverge.researcher.domain.*,cn.ac.cintcm.dataconverge.util.*" %> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
List subjectList = (List)request.getAttribute("modifyList"); 
String idStr = (String)request.getAttribute("idStr"); 
String imagePath = path + "/index/";
String isResfresh = (String)request.getAttribute("isResfresh"); 
Researcher researcher = (Researcher) request.getSession().getAttribute(
		Constants.USER_IN_SESSION); 
boolean isOrgLeader = AuthCheck.isInGroup(request,Constants.ORG_LEADER);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <title><%=Constants.APP_TITLE%>-课题状态修改</title> 
    <script language="javascript" type="text/javascript" src="<%=path %>/js/My97DatePicker/WdatePicker.js"></script>
	<script language="javascript" src="<%=path %>/index/Scripts/script.js"></script>
	<script language="javascript" src="<%=path %>/js/common.js"></script>
	<link href="<%=path %>/index/Themes/com/style.css" type="text/css" rel="stylesheet"></link>
	<script src='<%=basePath%>dwr/util.js'></script>  
	 <script type="text/javascript">
	    function uploadFile(){
	            if('0' == form1.fileType.value){
	            	alert("请选择文件类型");
	            	return;
	            }
	            if(isNull(form1.document.value)){
	            	alert("请选择文件");
	            	return;
	            }
	    		form1.submit();
	    } 
	    function saveState(){
	     	 var states = document.getElementsByName("state");
	     	 var selectState = '';
	     	 for(var i =0;i<states.length;i++){
	     	 	if(states[i].checked)
	     	 		selectState = states[i].value; 
	     	 }
	     	 if(''!= selectState){
	     	 	form1.submit();
	     	 
	     	 }
	    
	    }
    </script>
</head>
<body class="idt_body" scroll="yes">
 <div id="tdForm">
              <table border="0" cellpadding="0" cellspacing="1" width="100%" class="com_fieldset_tab">
                   <tr>
                      <td class="fim_l">
                          <strong>已选中课题</strong>
                      </td>
                </tr>
                 
              </table>
</div>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
        <tr>
            <td>
                <div class="content">
                    <table width="*" cellpadding="0" cellspacing="1" class="dg_borderstyle" id="Table4">
                        <tr>
                            <td class="dg_headerstyle">
                                序号</td>
                            <td class="dg_headerstyle">
                                课题编号</td>
                            <td class="dg_headerstyle" width="20%">
                                课题名称</td>
                                  <td class="dg_headerstyle" width="10%">
                                当前状态</td>
                            <td class="dg_headerstyle">
                                负责人</td>
                            <td class="dg_headerstyle">
                                申报时间</td> 
                        </tr>
                        <% if(subjectList.size()>0){
                               for(int i = 0;i<subjectList.size();i++){	
                        	           Subject obj = (Subject)subjectList.get(i);  
                        	           System.out.println("obj:" + obj);
                        	
                        %> 
                        <tr class="dg_alternatingitemstyle">
                            <td width="5%" align="center">
                                <%=i+1 %></td>
                            <td align="center" width="10%">
                                <%=StringUtilTool.NULL2Blank(obj.getSnumber()) %>
                            </td>
                            <td width="35%">
                                 <%=StringUtilTool.NULL2Blank(obj.getSubjectname()) %>
                            </td>
                            <td align="center">
                                <font color="red"><%=Constants.getSubjectStatus(obj.getState()) %></font>
                            </td>
                            <td>
                                  <%
                                   if(obj != null){
                                     Set res = obj.getSubRes();
                                     if(null != res){
                                     Iterator it = res.iterator();
                                     while(it.hasNext()){
                                         SubRes rearcher = (SubRes)it.next();
                                         if(null != rearcher && Constants.researcher_role_chargeman.equals(rearcher.getResRole()+"")){
                                        	 if(null!=rearcher.getRes()){
                                         	out.println(rearcher.getRes().getName());
                                         	out.println("&nbsp");
                                        	 }
                                         }
                                     }
                                     }
                                   } 
                                 %>
                            </td>
                            <td>
                               <%=Tools.getDateStringByDate1(obj.getApplydate()) %>
                            </td> 
                        </tr> 
                        <%}} %>
                    </table>
                </div>
            </td>
        </tr>
    </table>
    <form action="<%=path %>/subjectModify.htm?action=modifyStatus" name="form1" method="post">
   <div id="tdForm">
              <table border="0" cellpadding="0" cellspacing="1" width="100%" class="com_fieldset_tab">
                   <tr>
                      <td class="fim_l">
                          <strong>选择课题状态</strong>
                      </td>
                </tr>
                <tr>
                  <td class="fim_r">
                       <input type="radio" name="state" checked="true" value="<%=Constants.subject_state_checked%>"/>&nbsp;中标
                  </td>
                  <td class="fim_r">
                        <input type="radio" name="state" value="<%=Constants.subject_state_unchecked%>"/>&nbsp;未中标
                  </td> 
                  <td class="fim_r">
                     <input type="radio" name="state" value="<%=Constants.subject_state_researching%>"/>&nbsp;在研
                  </td>
                  <td class="fim_r">
                     <input type="radio" name="state" value="<%=Constants.subject_state_retuen%>"/>&nbsp;退回修改
                  </td>
                  <%if(isOrgLeader){ %>
                  <td class="fim_r">
                     <input type="radio" name="state" value="<%=Constants.subject_state_advised%>"/>&nbsp;推荐中标
                  </td>
                  <%} %>
                  <td class="fim_r">
                     <input type="radio" name="state" value="<%=Constants.subject_state_endApply%>"/>&nbsp;申请结题
                  </td>
                  <td class="fim_r">
                     <input type="radio" name="state" value="<%=Constants.subject_state_ended%>"/>&nbsp;已结题
                  </td>
              </tr>
              </table>
              </div>
    <table cellspacing="2" cellpadding="0" width="100%" class="idt_item_mg" id="Table2">
        <tr>
             
            <td class="fim_r" align="right" colspan="2">
            	<input type="hidden" value="<%=idStr %>" name="idStr" />
                <input type="button" value="保存"  onclick="saveState();" class="com_btn2" />
                <input type="button" value="关闭"  onclick="javaScript:window.close();" class="com_btn2" />
            </td>
        </tr> 
    </table> 
    </form>
                
</body>
</html>
<script type="text/javascript">
<!--
   <%if(null != isResfresh){%>
       alert('状态修改成功！');
       window.opener.document.pageForm.submit(); 
      // window.opener.document.location.replace(window.opener.document.location); 
   <%}%>
//-->
</script>
